package com.example.demo.dubbo.service;

import com.example.demo.dubbo.api.DemoService;
import org.springframework.stereotype.Service;

import java.util.concurrent.atomic.AtomicInteger;

@Service
public class DemoServiceImpl implements DemoService {

    private AtomicInteger atomicInteger = new AtomicInteger(0);
    @Override
    public String sayHello(String name) {
        try {
            Thread.sleep(3000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>:请求参数："+name+"请求次数："+atomicInteger.incrementAndGet());
        return "Hello " + name;
    }

    @Override
    public String helloWorld(String name) {
        try {
            Thread.sleep(30000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        return name;
    }
}